<?php
namespace Tbf\Component\Io\Tests\Buffer;
use Tbf\Component\Io\Buffer\ArrayBuffer;
use Tbf\Component\Io\Tests\TestCase;

class ArrayBufferTest extends TestCase
{
    public function testArrayBuffer()
    {
        $buffer = new ArrayBuffer();
        $buffer->writeRow(array(
            'a'=>1,
            'b'=>2
        ));
        $buffer->writeRow(array(
            'a'=>2,
            'b'=>3
        ));

        $data = $buffer->readRow();
        $this->assertEquals(array(
            'a'=>1,
            'b'=>2
        ),$data);

        $data = $buffer->readRow();
        $this->assertEquals(array(
            'a'=>2,
            'b'=>3
        ),$data);

        $data = $buffer->readRow();
        $this->assertEquals(null,$data);

        $data = $buffer->readRow();
        $this->assertEquals(null,$data);
    }
}
